<?php
declare (strict_types=1);

namespace app\admin\validate;

use think\Validate;

class MarketSocialMediaAccountGroup extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'name' => 'require|string',
        'remark' => 'string',
        'is_del' => 'in:0,1',
        'creator' => 'integer',
        'create_time' => 'datetime',
        'updater' => 'integer',
        'update_time' => 'datetime',
        'channel_id' => 'integer|require',
        'status' => 'in:0,1'
    ];

    // 错误信息提示
    protected $message = [
        'name.require' => '名称字段是必填的。',
        'name.string' => '名称字段必须是整数。',
        'is_del.in' => '状态字段只能是 0 或 1。',
        'creator.integer' => '创建人字段必须是整数。',
        'create_time.datetime' => '创建时间格式不正确。',
        'updater.integer' => '更新人字段必须是整数。',
        'update_time.datetime' => '更新时间格式不正确。',
        'channel_id.integer' => '渠道ID字段必须是整数。',
        'channel_id.require' => '渠道ID字段是必填的。'
    ];

    // 场景定义
    protected $scene = [
        'save' => ['name', 'remark', 'channel_id', 'status'],
        'update' => ['name', 'remark', 'channel_id', 'status'],
        'delete' => ['ids'],
        'status' => ['ids', 'status'],
        'search' => ['status']
    ];
}
